#ifndef ARDUINO_LIB_SERVO_CHIEF_H
#define ARDUINO_LIB_SERVO_CHIEF_H

#include <Arduino.h>
#include <Servo.h>

class ServoChief
{
  public:
    static const uint8_t delayTime = 15;
    static const uint8_t kMiddlePos = 93;
    static const uint8_t kMaxTurnAngle = 30;
    static const uint8_t kLeftLimit = kMiddlePos - kMaxTurnAngle;
    static const uint8_t kRightLimit = kMiddlePos + kMaxTurnAngle;
    enum TurnMode {
      TURN_MODE_LEFT = 0,
      TURN_MODE_RIGHT,
      TURN_MODE_STANDBY
    };
    ServoChief();
    ~ServoChief();
    void attach(uint8_t pin);
    void turnLeft(uint8_t v);
    void turnRight(uint8_t v);
    void returnBack();
    uint8_t angle();
  private:
    uint8_t angle_ {kMiddlePos};
    Servo servo;
};

#endif
